import '../api/json_placeholder_api.dart';
import '../model/user.dart';
import '../model/post.dart';
import '../model/comment.dart';
import '../model/album.dart';
import '../model/photo.dart';
import '../model/todo.dart';
import '../model/api_response.dart';

class JsonPlaceholderRepository {
  // 用户
  Future<ApiResponse<List<User>>> getUsers() => JsonPlaceholderApi.getUsers();
  Future<ApiResponse<User>> getUser(int id) => JsonPlaceholderApi.getUser(id);

  // 帖子
  Future<ApiResponse<List<Post>>> getPosts() => JsonPlaceholderApi.getPosts();
  Future<ApiResponse<Post>> getPost(int id) => JsonPlaceholderApi.getPost(id);
  Future<ApiResponse<Post>> createPost(Post post) =>
      JsonPlaceholderApi.createPost(post);

  // 评论
  Future<ApiResponse<List<Comment>>> getCommentsForPost(int postId) =>
      JsonPlaceholderApi.getCommentsForPost(postId);

  // 相册
  Future<ApiResponse<List<Album>>> getAlbumsForUser(int userId) =>
      JsonPlaceholderApi.getAlbumsForUser(userId);

  // 照片
  Future<ApiResponse<List<Photo>>> getPhotosForAlbum(int albumId) =>
      JsonPlaceholderApi.getPhotosForAlbum(albumId);

  // 待办事项
  Future<ApiResponse<List<Todo>>> getTodosForUser(int userId) =>
      JsonPlaceholderApi.getTodosForUser(userId);
}